package bean;
public class Distance{
	private int					id;
	private Point				point1;
	private Point				point2;
	private float				distance;
	/**
	 * end (x2,y2)  
	 * <br>*.............
	 * <br>.<------.
	 * <br>.<------.
	 * <br>.............*
	 * <br>(x1, y1) start
	 * <br>由point1/point2构建道路（矩形两点坐标）
	 * 
	 */
	private float				x1, y1, x2, y2;

	public Distance() {
		super();
	}

	public Distance(Point p1, Point p2, float dis) {
		this.point1 = p1;
		this.point2 = p2;
		this.distance = dis;
	}

	public Point getPoint1() {
		return point1;
	}

	public void setPoint1(Point point1) {
		this.point1 = point1;
	}

	public Point getPoint2() {
		return point2;
	}

	public void setPoint2(Point point2) {
		this.point2 = point2;
	}

	public float getDistance() {
		return distance;
	}

	public void setDistance(float distance) {
		this.distance = distance;
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Distance))
			return false;
		Distance di = (Distance) obj;
		if (this.getPoint1().equals(di.getPoint1())
				&& this.getPoint2().equals(di.getPoint2())
				&& this.getDistance() == di.getDistance())
			return true;
		return false;
	}

	@Override
	public int hashCode() {
		return (int) (this.getPoint1().hashCode() * this.getPoint2().hashCode() * this
				.getDistance());
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public float getX1() {
		return x1;
	}

	public void setX1(float x1) {
		this.x1 = x1;
	}

	public float getY1() {
		return y1;
	}

	public void setY1(float y1) {
		this.y1 = y1;
	}

	public float getX2() {
		return x2;
	}

	public void setX2(float x2) {
		this.x2 = x2;
	}

	public float getY2() {
		return y2;
	}

	public void setY2(float y2) {
		this.y2 = y2;
	}

}
